<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>The small3d library: BoundingBoxSet.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="customdoxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo_s.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">The small3d library
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_1bbf6a76ff8eaf46cd48acba40dce3d2.html">small3d</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">BoundingBoxSet.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_bounding_box_set_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_logger_8hpp.html">Logger.hpp</a>&quot;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;glm/glm.hpp&gt;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_model_8hpp.html">Model.hpp</a>&quot;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacesmall3d.html">small3d</a> {</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="classsmall3d_1_1_bounding_box_set.html">   27</a></span>&#160;  <span class="keyword">class </span><a class="code" href="classsmall3d_1_1_bounding_box_set.html">BoundingBoxSet</a> {</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;  <span class="keyword">private</span>:</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    uint32_t numBoxes = 0;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    <span class="keywordtype">void</span> triangulate();</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="keywordtype">void</span> calcExtremes();</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="keywordtype">void</span> generateBoxesFromExtremes();</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    <span class="keywordtype">void</span> generateExtremes(std::vector&lt;float&gt;&amp; vertexData, <span class="keyword">const</span> glm::vec3&amp; scale, uint32_t subdivisions);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="keywordtype">void</span> generateSubExtremes(std::vector&lt;float&gt;&amp; vertexData, <span class="keyword">const</span> glm::vec3&amp; scale);</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;  <span class="keyword">public</span>:</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160; </div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keyword">struct </span>extremes {</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    </div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;      <span class="keywordtype">float</span> minZ = 0.0f, maxZ = 0.0f, minX = 0.0f, maxX = 0.0f, minY = 0.0f, maxY = 0.0f;</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;      <span class="keywordtype">bool</span> tagged = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    </div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    };</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160; </div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classsmall3d_1_1_bounding_box_set.html#a954fb0543919362f873e9f59f61c83b8">   52</a></span>&#160;    std::vector&lt;extremes&gt; <a class="code" href="classsmall3d_1_1_bounding_box_set.html#a954fb0543919362f873e9f59f61c83b8">boxExtremes</a>;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classsmall3d_1_1_bounding_box_set.html#a0d8a4eac5d06e723ae60aef2bc2b0a83">getNumBoxes</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <a class="code" href="classsmall3d_1_1_bounding_box_set.html#ac180dc2880307f9adc399b208b58c6d9">BoundingBoxSet</a>();</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <a class="code" href="classsmall3d_1_1_bounding_box_set.html#ac180dc2880307f9adc399b208b58c6d9">BoundingBoxSet</a>(std::vector&lt;float&gt;&amp; vertexData, <span class="keyword">const</span> glm::vec3&amp; scale, uint32_t subdivisions);</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="classsmall3d_1_1_bounding_box_set.html#a60b57cda9c3d783c7d88f306ceda3060">   81</a></span>&#160;    <a class="code" href="classsmall3d_1_1_bounding_box_set.html#a60b57cda9c3d783c7d88f306ceda3060">~BoundingBoxSet</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classsmall3d_1_1_bounding_box_set.html#ad6565272cb69deaf226f4ae892975f93">   87</a></span>&#160;    std::vector&lt;std::vector&lt;float&gt; &gt; <a class="code" href="classsmall3d_1_1_bounding_box_set.html#ad6565272cb69deaf226f4ae892975f93">vertices</a>;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160; </div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="classsmall3d_1_1_bounding_box_set.html#a4cc9b979ea109f835753ec2c245e34b6">   93</a></span>&#160;    std::vector&lt;std::vector&lt;unsigned int&gt; &gt; <a class="code" href="classsmall3d_1_1_bounding_box_set.html#a4cc9b979ea109f835753ec2c245e34b6">facesVertexIndexes</a>;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160; </div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="classsmall3d_1_1_bounding_box_set.html#a543d45e64464ea9d7452b0a0816543dd">   98</a></span>&#160;    std::vector&lt;std::vector&lt;unsigned int&gt; &gt; <a class="code" href="classsmall3d_1_1_bounding_box_set.html#a543d45e64464ea9d7452b0a0816543dd">facesVertexIndexesTriangulated</a>;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160; </div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsmall3d_1_1_bounding_box_set.html#aa9b176c5242ab94a2edba46eb39b57b7">contains</a>(<span class="keyword">const</span> glm::vec3 point, <span class="keyword">const</span> glm::vec3 thisOffset,</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;      <span class="keyword">const</span> glm::mat4x4 thisRotation) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classsmall3d_1_1_bounding_box_set.html#a1c64a15bd255242e5b1ec9bc4c122aa2">containsCorners</a>(<span class="keyword">const</span> <a class="code" href="classsmall3d_1_1_bounding_box_set.html">BoundingBoxSet</a> otherBoxSet,</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;      <span class="keyword">const</span> glm::vec3 thisOffset,</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;      <span class="keyword">const</span> glm::mat4x4 thisRotation,</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;      <span class="keyword">const</span> glm::vec3 otherOffset,</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;      <span class="keyword">const</span> glm::mat4x4 otherRotation) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    std::vector&lt;Model&gt; <a class="code" href="classsmall3d_1_1_bounding_box_set.html#abf45f0d5ed515b0d7e5a9b319ba98f62">getModels</a>();</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;  };</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_a4cc9b979ea109f835753ec2c245e34b6"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#a4cc9b979ea109f835753ec2c245e34b6">small3d::BoundingBoxSet::facesVertexIndexes</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; unsigned int &gt; &gt; facesVertexIndexes</div><div class="ttdoc">Faces vertex indexes (rectangles)</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.hpp:93</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_aa9b176c5242ab94a2edba46eb39b57b7"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#aa9b176c5242ab94a2edba46eb39b57b7">small3d::BoundingBoxSet::contains</a></div><div class="ttdeci">bool contains(const glm::vec3 point, const glm::vec3 thisOffset, const glm::mat4x4 thisRotation) const</div><div class="ttdoc">Check if a point is inside any of the boxes.</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.cpp:32</div></div>
<div class="ttc" id="a_model_8hpp_html"><div class="ttname"><a href="_model_8hpp.html">Model.hpp</a></div><div class="ttdoc">A 3D model class.</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_ad6565272cb69deaf226f4ae892975f93"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#ad6565272cb69deaf226f4ae892975f93">small3d::BoundingBoxSet::vertices</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; float &gt; &gt; vertices</div><div class="ttdoc">Vertex coordinates.</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.hpp:87</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_a954fb0543919362f873e9f59f61c83b8"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#a954fb0543919362f873e9f59f61c83b8">small3d::BoundingBoxSet::boxExtremes</a></div><div class="ttdeci">std::vector&lt; extremes &gt; boxExtremes</div><div class="ttdoc">The extreme coordinates (max and min) of each box.</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.hpp:52</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_a1c64a15bd255242e5b1ec9bc4c122aa2"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#a1c64a15bd255242e5b1ec9bc4c122aa2">small3d::BoundingBoxSet::containsCorners</a></div><div class="ttdeci">bool containsCorners(const BoundingBoxSet otherBoxSet, const glm::vec3 thisOffset, const glm::mat4x4 thisRotation, const glm::vec3 otherOffset, const glm::mat4x4 otherRotation) const</div><div class="ttdoc">Check any of the corners of another set of bounding boxes is inside any of the boxes of this set.</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.cpp:61</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_a60b57cda9c3d783c7d88f306ceda3060"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#a60b57cda9c3d783c7d88f306ceda3060">small3d::BoundingBoxSet::~BoundingBoxSet</a></div><div class="ttdeci">~BoundingBoxSet()=default</div><div class="ttdoc">Destructor.</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html">small3d::BoundingBoxSet</a></div><div class="ttdoc">Set of bounding boxes for a SceneObject, calculated based on the vertices of a Model.</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.hpp:27</div></div>
<div class="ttc" id="anamespacesmall3d_html"><div class="ttname"><a href="namespacesmall3d.html">small3d</a></div><div class="ttdef"><b>Definition:</b> BinaryFile.hpp:15</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_ac180dc2880307f9adc399b208b58c6d9"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#ac180dc2880307f9adc399b208b58c6d9">small3d::BoundingBoxSet::BoundingBoxSet</a></div><div class="ttdeci">BoundingBoxSet()</div><div class="ttdoc">Default constructor.</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.cpp:22</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_a0d8a4eac5d06e723ae60aef2bc2b0a83"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#a0d8a4eac5d06e723ae60aef2bc2b0a83">small3d::BoundingBoxSet::getNumBoxes</a></div><div class="ttdeci">int getNumBoxes() const</div><div class="ttdoc">Get the number of boxes contained in the set.</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.cpp:343</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_a543d45e64464ea9d7452b0a0816543dd"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#a543d45e64464ea9d7452b0a0816543dd">small3d::BoundingBoxSet::facesVertexIndexesTriangulated</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; unsigned int &gt; &gt; facesVertexIndexesTriangulated</div><div class="ttdoc">Faces vertex indexes (triangles, for rendering)</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.hpp:98</div></div>
<div class="ttc" id="aclasssmall3d_1_1_bounding_box_set_html_abf45f0d5ed515b0d7e5a9b319ba98f62"><div class="ttname"><a href="classsmall3d_1_1_bounding_box_set.html#abf45f0d5ed515b0d7e5a9b319ba98f62">small3d::BoundingBoxSet::getModels</a></div><div class="ttdeci">std::vector&lt; Model &gt; getModels()</div><div class="ttdoc">Get the bounding boxes in a set of Models that can be rendered.</div><div class="ttdef"><b>Definition:</b> BoundingBoxSet.cpp:347</div></div>
<div class="ttc" id="a_logger_8hpp_html"><div class="ttname"><a href="_logger_8hpp.html">Logger.hpp</a></div><div class="ttdoc">Logger used in small3d.</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
